package com.wc.AlgoOJ_homework.AlgoOJ_BL2.E_双向排序;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/4/1 19:15
 * @description http://43.138.190.70:8888/p/199?tid=6602a6e518e03a818a4bf047
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    //    static int[][] a = new int[N][1];
    static int[] a = new int[N];
    static int[][] stk = new int[N][2];
    static int top = 0;
    static int n, m, x, y;

    // 性质1：开头是连续的后缀操作，可以直接删除
    // 性质2：如果是连续的前缀，只需要排最长的那一段前缀即可，同理后缀也是 -->> 有效操作必然是交替的
    // 性质3：如果前面连续的操作被后面的一个操作包含，那么他们也可以不做
    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
//        for (int i = 1; i <= n; i++) a[i][0] = i;
        while (m-- > 0) {
            x = sc.nextInt();
            y = sc.nextInt();
//            if (x > 0) {
//                Arrays.sort(a, y, n + 1, Comparator.comparingInt(o -> o[0]));
//            } else {
//                Arrays.sort(a, 1, y + 1, Comparator.comparingInt(o -> -o[0]));
//            }
            //        for (int i = 1; i <= n; i++) out.print(a[i][0] + " ");

            // 前缀操作
            if (x == 0) {
                // 取前面最大的前缀
                while (top > 0 && stk[top][0] == 0) y = Math.max(y, stk[top--][1]);
                // 删去前面包围的操作
                while (top >= 2 && stk[top - 1][1] <= y) top -= 2;
                // 加入当前
                stk[++top][0] = 0;
                // 根据性质1，开头是后续操纵，无需操作
            } else if (top > 0) {
                // 取前面最小的后缀
                while (top > 0 && stk[top][0] == 1) y = Math.min(y, stk[top--][1]);
                // 删去前面包围的操作
                while (top >= 2 && stk[top - 1][1] >= y) top -= 2;
                // 加入当前
                stk[++top][0] = 1;
            }
            stk[top][1] = y;
        }
        // 根据性质1，一定是从后面先开始填写的，所以是从n开头
        int k = n, l = 1, r = n;
        for (int i = 1; i <= top; i++) {
            // 前缀操作，后面的会被固定, 反之
            if (stk[i][0] == 0) {
                while (r > stk[i][1] && l <= r) a[r--] = k--;
            } else {
                while (l < stk[i][1] && l <= r) a[l++] = k--;
            }
            // 区间为空了，不需要操作了
            if (l > r) break;
        }
        // 如果是奇数的话，最后一步还是左区间的操作
        if ((top & 1) == 1) {
            while (l <= r) a[l++] = k--;
        } else {
            // 如果是偶数，最后一步是有区间的操作
            while (l <= r) a[r--] = k--;
        }
        for (int i = 1; i <= n; i++) out.print(a[i] + " ");
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }

    BigInteger nextBigInteger() {
        return new BigInteger(next());
    }
}
